package org.mathig.poker;

/**
 * Poker player (main interface that developpers should implement).
 * <p>
 * We assume a Player knows how to play Poker.<br>
 * If a player try to cheat or just make a mistake, the poker engine will correct it with the nearest logical action. But we keep the freedom of firing a player
 * from this table if cheating is too loud !
 * 
 * @author mathig
 */
public interface Player {

   /**
    * Player name (should be static).
    * 
    * @return name
    */
   String getName();

   /**
    * The croupier deals you 2 cards at begin of each hand.
    * 
    * @param cards
    */
   void receive(Context context, Card[] cards);

   /**
    * Returns the action for this player.<br>
    * <p>
    * If you return null, we consider the player fold.
    * <p>
    * Example : <code>return actions.fold();</code>
    * 
    * @param table
    * @return the new bet (0 to fold)
    */
   Action response(Context context, AfterNothingActions actions);

   /**
    * Returns the new total bet for this player.
    * <p>
    * If you return null, we consider the player fold.
    * 
    * @param table
    * @return the new bet (0 to fold)
    */
   Action response(Context context, AfterBetActions actions);

   /**
    * Do you want to muck (refuse to show your cards) ?
    * <p>
    * This question is posed in two cases :
    * <ul>
    * <li>when you win because all others fold
    * <li>when you lose a showdown
    * </ul>
    * 
    * @param round
    * @return
    */
   boolean doYouMuck(Context table);

}
